package spec.chencaihui.uint4.ex;

public class Test1 {
    public static void main(String[] args) {
//         Student1 mgt=new Student1("蘑菇头","7777","四川幼专");
//        CollegeStudent1 my=new CollegeStudent1("麦爷","1111","四川幼专","软件与信息服务一班","趣味电学");
//        System.out.println(mgt.xm+","+mgt.xh+","+mgt.xx);
//        System.out.println(my.xm+","+my.xh+","+my.xx+","+my.bj+","+my.xk);
//        System.out.println(mgt.study());
//        System.out.println(my.study());
//        System.out.println(mgt.hashCode());
        //hashCode是jdk根据对象的地址或者字符串或者数字算出来的int类型的数值
        Student1 mm=new SmallStudent("毛毛","32232","外国语学校","1.1","30kg");
//        System.out.println(mm.study());
        //强制类型转换

//        SmallStudent ss=(SmallStudent) mm;
//        System.out.println(ss.kjc());

        if(mm instanceof Student1){
            System.out.println("mm is a student");
        }
        //instanceof得到的结果是true or false
        if(mm instanceof SmallStudent){
            System.out.println("mm is a small student");
        }
        //——如果是子类的对象，它的结果也可以是父类或者子类

//        SmallStudent ss=new Student1("毛毛","2222","中坝职中");
        //小学生有身高、体重，然而学生没有身高和体重，所以属性不同。
//        SmallStudent-->Student1<--CollegeStudent1
    }
}


